accessToken = require("../utils/access-token")
rest = require("rest")
Config = require("../config")

exports.gGetInfo = (code)->
    accessT = yield from accessToken.gGetAccessToken(code)
    access = accessT.value
    openid = accessT.openid

    url = "https://api.weixin.qq.com/sns/userinfo?access_token=" + access + "&openid=" + openid + "&lang=zh_CN"
    data = yield rest(url)
    data = JSON.parse(data.entity)
    console.log("user info:++++++" + data)
    console.log(data)
    console.log("user info:++++++" + data)
    data

